
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <h1>ReadMe</h1>
        The purpose of this spike is to compare different implementation strategies for server-sent events 
        in servlet-based web applications. 
        There are four different strategies implemented: 
        <ol>
            <li><b>RequestPerEvent</b> - in the request, an event is generated and the output stream is then closed, forcing the client to reconnect</li>.
            <li><b>InfiniteLoop</b> - in the request, a while(true) loop is started. In this loop, events are generated and the output stream is flushed, followed by Thread.sleep(..)</li>
            <li><b>RequestPerEventBuffered</b> - this is a combination of 1. and 2., a while loop is used to generate some events for a certain time (set by a timeout parameter), then the stream is closed, forcing the client to reconnect.</li>
            <li><b>Async</b> - uses asynchronous servlet features to generate events in the background. 
        </ol>    
        The <b>*StressTest</b> pages work as follows: there are 20 div elements, each associated with an EventSource.
        The respective events update the timestamp in the respective elements. The different implementations differ in two key aspects:
        <ol>
            <li>usage of threads from the server thread pool</li>
            <li>number of reconnects required</li>
        </ol> 
        To test the first aspect, the size of the server thread pool should be set to a value less than 20 (e.g., 5). 
        For Tomcat 7, this can be done by editing server.xml, and changing the tomcatThreadPool executor maxThreads property.
        <br/>
        Note that after running the InfiniteLoop tests, the server must be restarted.
        <p/>
        <h2>Stress Tests</h2>
        <ol>
            <li><a href="RequestPerEventStressTest.html">RequestPerEvent Stress Test</a></li>
            <li><a href="InfiniteLoopStressTest.html">InfiniteLoop Stress Test</a></li>
            <li><a href="RequestPerEventBufferedStressTest.html">RequestPerEventBuffered Stress Test</a></li>
            <li><a href="AsyncStressTest.html">Async Stress Test</a></li>
        </ol>
    </body>
</html>
